#include <stdlib.h>

#include "common.h"


#ifdef __cplusplus

void __cxa_pure_virtual() { while(1); }

#if !defined(NO_THREADSAFE_STATICS)
int 	__cxa_guard_acquire(__guard *g) { return !*(char*)(g); }
void	__cxa_guard_release(__guard *g) { *(char*)g = 1; }
void	__cxa_guard_abort(__guard *g) { }
#endif

void * operator new(size_t size)
{
	return malloc(size);
}
// Placement new default
void * operator new(size_t, void *p)
{
	return p;
}

void * operator new [] (size_t size)
{
	return malloc(size);
}

void operator delete(void * ptr)
{
	if (ptr)
		free(ptr);
}

void operator delete [] (void * ptr)
{
	if (ptr)
		free(ptr);
}

void operator delete(void * p, void * const b)
{

}
#endif
